package me.zhengjie.suli.tasks.rest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.suli.tasks.service.TaskDetailService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @website https://www.chinasuli.com.cn/
 * @author Allen Gao
 * @date 2023-01-09
 **/
@RestController
@RequiredArgsConstructor
@Api(tags = "任务明细")
@RequestMapping("/api/taskDetail")
public class TaskDetailController {
    private final TaskDetailService taskDetailService;

    @GetMapping(value = "/getTaskDetailsByTaskId/{id}")
    @Log("根据ID查询收货明细")
    @ApiOperation("根据ID查询收货明细")
    public ResponseEntity<Object> getTaskDetailsByTaskId(@PathVariable String id) {
        return new ResponseEntity<>(taskDetailService.getTaskDetailsByTaskId(id), HttpStatus.OK);
    }

    @PostMapping(value = "/pdaGetTaskDetailsByTaskCode")
    @Log("根据ID查询收货明细")
    @ApiOperation("根据ID查询收货明细")
    public ResponseEntity<Object> pdaGetTaskDetailsByTaskCode(@RequestBody String taskCode) {
        return new ResponseEntity<>(taskDetailService.pdaGetTaskDetailsByTaskCode(taskCode), HttpStatus.OK);
    }


}
